+Thu Oct 30 16:20:58 2003 Soeren Sandmann <sandmann@daimi.au.dk>
+
+ * gtk/gtktoolbar.c (logical_to_physical): Make sure we actually
+ return the index of a real item.
+ (get_nth_item) assert that the returned items is not a
+ placeholder. (#125826, Marco Pesenti Gritti).
+
2003-10-29 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkcellrendererseptext.c
+Thu Oct 30 16:20:58 2003 Soeren Sandmann <sandmann@daimi.au.dk>
+
+ * gtk/gtktoolbar.c (logical_to_physical): Make sure we actually
+ return the index of a real item.
+ (get_nth_item) assert that the returned items is not a
+ placeholder. (#125826, Marco Pesenti Gritti).
+
2003-10-29 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkcellrendererseptext.c
+Thu Oct 30 16:20:58 2003 Soeren Sandmann <sandmann@daimi.au.dk>
+
+ * gtk/gtktoolbar.c (logical_to_physical): Make sure we actually
+ return the index of a real item.
+ (get_nth_item) assert that the returned items is not a
+ placeholder. (#125826, Marco Pesenti Gritti).
+
2003-10-29 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkcellrendererseptext.c
+Thu Oct 30 16:20:58 2003 Soeren Sandmann <sandmann@daimi.au.dk>
+
+ * gtk/gtktoolbar.c (logical_to_physical): Make sure we actually
+ return the index of a real item.
+ (get_nth_item) assert that the returned items is not a
+ placeholder. (#125826, Marco Pesenti Gritti).
+
2003-10-29 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkcellrendererseptext.c
+Thu Oct 30 16:20:58 2003 Soeren Sandmann <sandmann@daimi.au.dk>
+
+ * gtk/gtktoolbar.c (logical_to_physical): Make sure we actually
+ return the index of a real item.
+ (get_nth_item) assert that the returned items is not a
+ placeholder. (#125826, Marco Pesenti Gritti).
+
2003-10-29 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkcellrendererseptext.c
g_assert (logical >= 0);
physical = 0;
- for (list = priv->content; list && logical > 0; list = list->next)
+ for (list = priv->content; list; list = list->next)
{
ToolbarContent *content = list->data;
if (!content->is_placeholder)
logical--;
physical++;
- }
+ if (!content->is_placeholder && logical == 0)
+ break;
+ }
+
g_assert (logical == 0);
return physical;
}
{
GtkToolbarPrivate *priv;
ToolbarContent *content;
+ gint n_items;
g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), NULL);
if (!gtk_toolbar_check_new_api (toolbar))
return NULL;
+
+ n_items = gtk_toolbar_get_n_items (toolbar);
+
+ if (n < 0 || n >= n_items)
+ return NULL;
priv = GTK_TOOLBAR_GET_PRIVATE (toolbar);
content = g_list_nth_data (priv->content, logical_to_physical (toolbar, n));
-
- if (content)
- return content->item;
- return NULL;
+ g_assert (content);
+ g_assert (!content->is_placeholder);
+
+ return content->item;
}
/**